package dk.itu.mmad.travelapp3;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;

public class Checkin extends Fragment {
	static String chIn;
	String tag = "CheckIn";


	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		LinearLayout mll = (LinearLayout) inflater.inflate(R.layout.activity_checkin, container, false);
		Log.i(tag, "1 Not died, yet ");
		Button button  = (Button) mll.findViewById(R.id.checkinbutton);
		Log.i(tag, "3 Not died, yet ");
		button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				EditText ed = (EditText) getActivity().findViewById(R.id.checkinstation);
				chIn = ed.getText().toString();
				Log.i(tag, chIn + " Checked in");
				Toast.makeText(getActivity(), chIn, Toast.LENGTH_SHORT).show();
				Log.i(tag, "4 Not died, yet ");
			}
		});
		return mll;

	}
}
